(*--------------------------------------------------------
    Holt                  http://coderesearchlabs.com/holt
    by Javier Santo Domingo (j-a-s-d@coderesearchlabs.com)
  --------------------------------------------------------
    constants
  --------------------------------------------------------*)

unit holt_consts;

{$I holt_defines.inc}

interface

const
  // GENERAL ----------------------------------------------------------------
  NAME = 'Holt';
  MAJOR = '1';
  MINOR = '5';
  VERSION = MAJOR + '.' + MINOR;
  URL = 'http://coderesearchlabs.com/holt';
  COPYRIGHT = 'by Javier Santo Domingo (j-a-s-d@coderesearchlabs.com)';
  TITLE = NAME + ' ' + VERSION + '              ' + URL + #10 + COPYRIGHT;

  SEPARATOR = '------------------------------------------------------';

  FILE_INIT = 'init.holt';
  SUBDIRECTORY_EMITTERS = 'emitters';

  INDENT = ' ';
  COMMA = ';';
  SLASH = '/';
  EMITTER_OK = '0';

  // OPCODES ----------------------------------------------------------------
  OPCODE_NONE = #0;
  // tree related opcodes
  OPCODE_NAVIGATE = ' ';
  OPCODE_PARENT = '.';
  OPCODE_PATH = '/';
  OPCODE_TREE = 't';
  OPCODE_SEARCH = 's';
  OPCODE_DROP = '~';
  OPCODE_PERSIST = 'p';
  OPCODE_EXECUTE = 'x';

  // node related opcodes
  OPCODE_ADD = '+';
  OPCODE_DELETE = '-';
  OPCODE_RENAME = 'r';
  OPCODE_VALUE = '=';
  OPCODE_KIND = ':';
  OPCODE_INFO = 'i';
  OPCODE_UP = 'u';
  OPCODE_DOWN = 'd';
  OPCODE_FLIP = 'f';
  OPCODE_REBASE = '@';
  OPCODE_TRUNCATE = '|';

  // emitter related opcodes
  OPCODE_EMITTERS = '>';
  OPCODE_RELOAD = '^';
  OPCODE_EMITTER = '<';
  OPCODE_EMIT = '!';

  // general opcodes
  OPCODE_GLOBAL = '#';
  OPCODE_COMMENT = ';';
  OPCODE_HELP = '?';
  OPCODE_QUIT = 'q';

  GLOBAL_DEBUG = 'DEBUG';

  // MESSAGES ----------------------------------------------------------------
  MSG_DONE = '';
  MSG_PROMPT = '>';
  MSG_ERROR = 'ERROR';
  MSG_TREE = 'tree';
  MSG_INFO = 'info';
  MSG_EMITTERS = 'emitters';
  MSG_SELECT_EMITTER = 'please, select an emitter';
  MSG_EMITTER = 'emitter';
  MSG_PARAMETER_REQUIRED = 'parameter required';
  MSG_VALUE_REQUIRED = 'value required';
  MSG_UNKNOWN_OPCODE = 'what?.. for help enter '+OPCODE_HELP;
  MSG_KINDS = 'kinds';
  MSG_KIND = 'kind';
  MSG_NAME = 'name';
  MSG_VALUE = 'value';
  MSG_LEVEL = 'level';
  MSG_POSITION = 'position';
  MSG_CHILDREN = 'children';
  MSG_OK = 'ok';
  MSG_DISABLED = 'disabled';
  MSG_LOAD_LIBRARY_FAILED = 'failed loading library';
  MSG_LOAD_ROUTINES_FAILED = 'failed loading routines';
  MSG_NODE_NAME = 'node name';
  MSG_NODE_VALUE = 'node value';
  MSG_NODE_KIND = 'node kind';
  MSG_NODE_PATH = 'node path';
  MSG_GLOBAL_NAME = 'global name';
  MSG_GLOBAL_VALUE = 'global value';
  MSG_FILE = 'file';
  MSG_EMITTER_NAME = 'emitter name';
  MSG_DESTINATION = 'destination';
  MSG_RESULTS = 'results';

  MSG_HELP = TITLE
  + #10
  + #10 + 'description'
  + #10 + SEPARATOR
  + #10
  + #10 + '  Holt is a general purpose tree structures editor with'
  + #10 + '  multiple emission capabilities.'
  + #10
  + #10 + '  This minimallist tree builder is intended for the quick'
  + #10 + '  generation of structures of any kind such as, and not'
  + #10 + '  limited to: programs, libraries, units, classes, enums,'
  + #10 + '  directory trees, plain documents, and/or whatever you'
  + #10 + '  have an emitter for. And if the emitter you want does'
  + #10 + '  not exists, you can create your own in an easy way!'
  + #10
  + #10
  + #10 + 'rules'
  + #10 + SEPARATOR
  + #10
  + #10 + '  NODES'
  + #10 + '  * there is only a tree which can contain only nodes'
  + #10 + '  * a node is composed by a name, a value and an optional kind'
  + #10 + '  * nodes do not have a kind by default'
  + #10 + '  * nodes are name-unique inside their parent scope'
  + #10 + '  * node names are case insensitive'
  + #10 + '  * node names must be 2 characters long at least'
  + #10 + '  * node in a tree can have kinds interpretable by different emitters'
  + #10 + '  OPCODES'
  + #10 + '  * opcodes are took from the command line if the second char is a space'
  + #10 + '  * opcode-less lines are interpreted as the parameter of the default opcode'
  + #10 + '  * the default opcode is NAVIGATION which has no representation'
  + #10 + '  EMITTERS'
  + #10 + '  * emitters are plugineable dynamic link libraries which implement interface routines'
  + #10 + '  * emitters are activated once when first loading, and again for emission'
  + #10 + '  * emitters which does not fullfil the expected routines will be disabled'
  + #10 + '  * on emitter name clash the last to appear will be disabled'
  + #10 + '  * only one emitter can be active at a time'
  + #10 + '  * every emitter snould tell for each level which kind of nodes it does support'
  + #10 + '  * emitters ignore nodes that can not handle (unknown kind, invalid names, level too high, etc)'
  + #10 + '  * emitter routines only return pchar values, even when returning numbers'
  + #10
  + #10
  + #10 + 'commands'
  + #10 + SEPARATOR
  + #10
  + #10 + '  <' + MSG_NODE_NAME + '>'
  + #10 + '  changes path to the specified node (is added if not found) -- DEFAULT'
  + #10
  + #10 + '  ' + OPCODE_ADD + ' <' + MSG_NODE_NAME + '>'
  + #10 + '  adds the specified child node'
  + #10
  + #10 + '  ' + OPCODE_DELETE + ' <' + MSG_NODE_NAME + '>'
  + #10 + '  removes the specified child node'
  + #10
  + #10 + '  ' + OPCODE_RENAME + ' <' + MSG_NODE_NAME + '>'
  + #10 + '  renames the current node'
  + #10
  + #10 + '  ' + OPCODE_VALUE + ' <' + MSG_NODE_VALUE + '>'
  + #10 + '  sets the value for the current node'
  + #10
  + #10 + '  ' + OPCODE_KIND + ' <' + MSG_NODE_KIND + '>'
  + #10 + '  sets a fixed kind for the current node'
  + #10
  + #10 + '  ' + OPCODE_INFO
  + #10 + '  show info for the current node'
  + #10
  + #10 + '  ' + OPCODE_UP + ' <' + MSG_NODE_NAME + '>'
  + #10 + '  moves up the position of the specified node inside the parent childs'
  + #10
  + #10 + '  ' + OPCODE_DOWN + ' <' + MSG_NODE_NAME + '>'
  + #10 + '  moves down the position of the specified node inside the parent childs'
  + #10
  + #10 + '  ' + OPCODE_FLIP
  + #10 + '  reverses the positions of the current node childs'
  + #10
  + #10 + '  ' + OPCODE_PERSIST + ' <' + MSG_FILE + '>'
  + #10 + '  persists the current tree from the current node to file as commands'
  + #10
  + #10 + '  ' + OPCODE_EXECUTE + ' <' + MSG_FILE + '>'
  + #10 + '  executes the specified commands file using the current tree'
  + #10
  + #10 + '  ' + OPCODE_REBASE
  + #10 + '  rebases the current tree by taking the current node as the new root'
  + #10
  + #10 + '  ' + OPCODE_TRUNCATE
  + #10 + '  truncates the current tree by droping all the current node childs'
  + #10
  + #10 + '  ' + OPCODE_DROP
  + #10 + '  drops the current tree'
  + #10
  + #10 + '  ' + OPCODE_EMITTERS + ' [<' + MSG_EMITTER_NAME + '>]'
  + #10 + '  loads the specified emitter (lists all the emitters on omitted parameter)'
  + #10
  + #10 + '  ' + OPCODE_EMITTER + ' [<' + MSG_EMITTER_NAME + '>]'
  + #10 + '  sets the current emitter (displays current emitter name on omitted parameter)'
  + #10
  + #10 + '  ' + OPCODE_RELOAD + ' <' + MSG_EMITTER_NAME + '>'
  + #10 + '  reloads the specified emitter'
  + #10
  + #10 + '  ' + OPCODE_EMIT + ' <' + MSG_DESTINATION + '>'
  + #10 + '  emits the current tree from the current node to the specified destination'
  + #10
  + #10 + '  ' + OPCODE_TREE
  + #10 + '  displays the tree structure from the current node'
  + #10
  + #10 + '  ' + OPCODE_SEARCH
  + #10 + '  searches the specified text in the tree structure from the current node'
  + #10
  + #10 + '  ' + OPCODE_PARENT
  + #10 + '  goes to the parent node'
  + #10
  + #10 + '  ' + OPCODE_PATH + ' [<' + MSG_NODE_PATH + '>]'
  + #10 + '  goes to the specified path (goes to the root node on omitted parameter)'
  + #10
  + #10 + '  ' + OPCODE_GLOBAL + ' <' + MSG_GLOBAL_NAME + '>[=<' + MSG_GLOBAL_VALUE + '>]'
  + #10 + '  sets a global flag or variable (displays content on omitted parameter)'
  + #10
  + #10 + '  ' + OPCODE_COMMENT
  + #10 + '  determines the current line is a comment'
  + #10
  + #10 + '  ' + OPCODE_HELP
  + #10 + '  displays this help'
  + #10
  + #10 + '  ' + OPCODE_QUIT
  + #10 + '  quits to the system'
  + #10;

implementation

end.
